package com.itheima.service.impl;

import com.itheima.dao.Studentdao;
import com.itheima.pojo.Student;
import com.itheima.service.Studentservice;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;
@Component
public class StudentserviceA implements Studentservice {
    @Autowired
    private Studentdao studentdao;
    @Override
    public List<Student> empService() {

        List<Student> studentList = studentdao.listEmp();
        studentList.stream().forEach(student -> {
            if("1".equals(student.getGender())){
                student.setGender("男");
            }else if("2".equals(student.getGender())){
                student.setGender("女");
            }

            Integer score = student.getScore();
            if(score >= 85){
                student.setLevel("优秀");
            }else if(score >= 60){
                student.setLevel("及格");
            }else{
                student.setLevel("不及格");
            }
        });
        return studentList;
    }
}
